package net.bplaced.streetfighter.adapter;

import java.util.List;

import net.bplaced.streetfighter.R;
import net.bplaced.streetfighter.lib.model.GoalGetter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.de>
 */
public class GoalGetterAdapter
        extends AbstractAdapter<GoalGetter> {

    public GoalGetterAdapter(final Context context, final List<GoalGetter> goalgetters) {

        super(context, goalgetters);
    }

    @Override
    View getView(int position, View convertView, LayoutInflater inflater) {

        final GoalGetter g = this.items.get(position);

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.adapter_item_goalgetter, null);
        }

        // Name field
        final TextView nameField = (TextView) convertView.findViewById(R.id.goalgetter_adapter_item_name);
        nameField.setText(g.playerName);

        // Goals field
        final TextView goalsField = (TextView) convertView.findViewById(R.id.goalgetter_adapter_item_goals);
        goalsField.setText(g.playerGoals.toString());

        return convertView;
    }
}